


## ========================================================= ##
## Only Modify Here, if you want to add a driver directory   ##
## !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ##
## ========================================================= ##

if(CFG_USE_PL011)
list(APPEND LST_ASTRAL pl011)
elseif(CFG_USE_16550)
list(APPEND LST_ASTRAL ns16550)
endif()
list(APPEND LST_ASTRAL ramdisk)
list(APPEND LST_ASTRAL null)
list(APPEND LST_ASTRAL pl111)
list(APPEND LST_ASTRAL pl180)
list(APPEND LST_ASTRAL lan911x)


include_directories(${GLB_INC_DIR}/innerapi)
include_directories(${GLB_INC_DIR}/kernel)

## usually, do not need to modify things below this line
## ========================================================= ##

set(THIS_LIBNAME driver)
project(${THIS_LIBNAME})

foreach(SUBMOD ${LST_ASTRAL})
    file(GLOB_RECURSE SRCS_C ${CMAKE_CURRENT_LIST_DIR}/${SUBMOD}/*.c)
    file(GLOB_RECURSE SRCS_S ${CMAKE_CURRENT_LIST_DIR}/${SUBMOD}/*.S)
    list(APPEND SRCS ${SRCS_C} ${SRCS_S})
endforeach()

## ===================================== ##
## Generally, it is NOT been supposed    ##
## to modify the code below this line.   ##
## ===================================== ##

message(STATUS "\n-- [^.^]********${THIS_LIBNAME}********[^.^]")
message(STATUS "The sources in [ " ${CMAKE_CURRENT_LIST_DIR} " ] are:")
foreach(SRC ${SRCS})
    message(STATUS "[src] " ${SRC})
endforeach()

add_library(${THIS_LIBNAME}s STATIC ${SRCS})
merge_sections(${THIS_LIBNAME}s)

rearchive(${THIS_LIBNAME} OBJS ${THIS_LIBNAME}s)
